//AttackSubStateMachine
import DirectionSubStateMachine from '../../Base/DirectionSubStateMachine'
import { DIRECTION_ENUM, EVENT_ENUM, SHAKE_TYPE_ENUM } from '../../Enum'
import State, { ABIMATION_SPEED } from '../../Base/State'
import { StateMachine } from '../../Base/StateMachine'
import { AnimationClip } from 'cc'
import EventManager from '../../Runtime/EventManager'

const BASE_URL = 'texture/player/attack'

export default class AttackSubStateMachine extends DirectionSubStateMachine {
    constructor(fsm: StateMachine) {
        super(fsm)
        this.stateMachines.set(DIRECTION_ENUM.TOP, new State(fsm, `${BASE_URL}/top`, AnimationClip.WrapMode.Normal, [
            {
                frame: ABIMATION_SPEED * 4,
                func: 'onAttackShake',
                params: [SHAKE_TYPE_ENUM.TOP],
            },
        ]))
        this.stateMachines.set(DIRECTION_ENUM.BOTTOM, new State(fsm, `${BASE_URL}/bottom`, AnimationClip.WrapMode.Normal, [
            {

                frame: ABIMATION_SPEED * 4, // 第 0.5 秒时触发事件
                func: 'onAttackShake', // 事件触发时调用的函数名称
                params: [SHAKE_TYPE_ENUM.BOTTOM], // 向 `func` 传递的参数
            },
        ]))
        this.stateMachines.set(DIRECTION_ENUM.LEFT, new State(fsm, `${BASE_URL}/left`, AnimationClip.WrapMode.Normal, [
            {

                frame: ABIMATION_SPEED * 4, // 第 0.5 秒时触发事件
                func: 'onAttackShake', // 事件触发时调用的函数名称
                params: [SHAKE_TYPE_ENUM.LEFT], // 向 `func` 传递的参数
            },
        ]))
        this.stateMachines.set(DIRECTION_ENUM.RIGHT, new State(fsm, `${BASE_URL}/right`, AnimationClip.WrapMode.Normal, [
            {
                
                frame: ABIMATION_SPEED * 4, // 第 0.5 秒时触发事件
                func: 'onAttackShake', // 事件触发时调用的函数名称
                params: [SHAKE_TYPE_ENUM.RIGHT], // 向 `func` 传递的参数
            },
        ]))
    }


}
